common/gnttab: Explicitly default to gnttab v1 during domain creation
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 8 Aug 2018 14:54:30 +0000 (15:54 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 10 Aug 2018 12:27:24 +0000 (13:27 +0100)
commit1237659523813696af4083279a7b871d407cbd48
treeac1f80a081168011d58dbe0f9104ac9eb15a2483
parentb6f43c14cef3af8477a9eca4efab87dd150a2885
common/gnttab: Explicitly default to gnttab v1 during domain creation

For reasons which appear to be exclusively down to poor review of the grant
table v2 code, a grant table's version field was wasn't initialised during
creation.

A number of problems (including XSAs) have occurred in the past trying trying
to use a grant table which hasn't been properly set up, and various areas of
the code cope with v0 by defaulting to v1.

In particular, the toolstack using GNTTABOP_setup_table to be able to fill in
the store/console grants has a side effect of switching to v1.

In hindsight however, this "fixup if we see 0" is a very poor, with a
substantial degree of risk.  Explicitly default to grant table v1 during
domain create, and let the rest of the code work safely in the knowledge that
the version is sensibly set.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/common/grant_table.c